﻿using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using static WebApplication1.Controllers.Pono_NoController;

namespace WebApplication1.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class DataController : ControllerBase
    {
        private readonly LegacyService2 _legacyService;

        public DataController(LegacyService2 legacyService)
        {
            _legacyService = legacyService;
        }

        [HttpGet("process")]
        public async Task<IActionResult> Process([FromQuery] string input)
        {
            string result = await _legacyService.CallLegacyAsync(input);
            return Ok(result); // 返回给调用者，比如浏览器或 Postman
        }



        /// <summary>
        /// 原始数据；[炉号钩号]
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("login")]
        [AllowAnonymous]

        public async Task<IActionResult>  Login([FromQuery] string input)
        {
            string result = await _legacyService.CallLegacyAsync(input);
            return Ok(result); // 返回给调用者，比如浏览器或 Postman
        }


    }
}
